﻿using System;
using System.Collections.Generic;
using UniMana.Utils.Controls;
using UniMana.Data;
using UniMana.Utils.Data;

namespace UniMana.Win.Training
{
    public partial class FrmSchedule_SubChooseTeacher : DevExpress.XtraEditors.XtraForm
    {
        private int m_iDayOfWeek;
        private int m_iSession;
        private int m_iSubjectKey;
        private DateTime m_dStartTime;
        private DateTime m_dEndTime;
        private bds m_bdsPersonel;
        private DBMain m_data = new DBMain();
        private List<Guid> m_lGPersonnel;

        public FrmSchedule_SubChooseTeacher()
        {
            InitializeComponent();
            this.ShowInTaskbar = false;
        }

        public FrmSchedule_SubChooseTeacher(
            int _iDayOfWeek,
            int _iSession,
            DateTime _dStartTime,
            DateTime _dEndTime,
            int _iSubjectKey)
        {
            InitializeComponent();
            this.ShowInTaskbar = false;
            this.m_iDayOfWeek = _iDayOfWeek;
            this.m_iSession = _iSession;
            this.m_dStartTime = _dStartTime;
            this.m_dEndTime = _dEndTime;
            this.m_iSubjectKey = _iSubjectKey;
            this.m_lGPersonnel = new List<Guid>();
            LoadData();
        }

        private void LoadData()
        {
            this.m_bdsPersonel = new bds();
            this.m_bdsPersonel.DataSource =
                m_data.m_DCReadOnly.Personnel_Personnels.GetListTeacher(
                m_data.m_DCReadOnly.Personnel_Personnel_Sessions,
                m_data.m_DCReadOnly.Personnel_Personnel_SubjectRegists,
                m_iSession,
                m_iDayOfWeek,
                m_dStartTime,
                m_dEndTime,
                m_iSubjectKey);
            //this.gctPersonnel_Personnel.DataSource = this.m_bdsPersonel;
        }

        //private void btnSelect_Click(object sender, EventArgs e)
        //{
        //    if (this.grvPersonnel_Personnel.SelectedRowsCount > 0)
        //    {
        //        int[] row = this.grvPersonnel_Personnel.GetSelectedRows();
        //        this.m_lGPersonnel.Clear();
        //        for (int i = 0; i < row.Length; i++)
        //        {
        //            Guid personnelKey = this.grvPersonnel_Personnel.GetRowCellValue(
        //                row[i], 
        //                this.gclPersonnel_PersonnelKey).ToGuid();
        //            this.m_lGPersonnel.Add(personnelKey);
        //        }
        //        this.DialogResult = System.Windows.Forms.DialogResult.OK;
        //        this.Close();
        //    }
        //}

        //private void btnCancel_Click(object sender, EventArgs e)
        //{
        //    this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
        //    this.Close();
        //}

        //public List<Guid> ListPersonnel
        //{
        //    get { return this.m_lGPersonnel; }
        //}
    }
}